<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * 接口测试
 * @author www.dingwei.cn
 */
class Test extends CI_Controller {
//    protected $HTTP = 'http://192.168.1.35/gebi/merchant/app/';
    protected $HTTP = 'http://app.gebishiji.com/merchant/app/';
    protected $SESSIONID = 'd8bd6b7fea94d181f6b449f6a1b40f337c9cd40b';

    public function __construct(){
        parent::__construct();
        $this->SESSIONID = encode('a676ed521dc283b3709fdee3bf9475224137ceda');
//        p($this->SESSIONID);
    }
	public function test(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/test';
        $param = array(
            'sessionid' => $this->SESSIONID,
        );

        $this->_request($url, $param);
    }
	/**
	 * 注册验证吗
	 */
	public function getRegisterVerifyCode(){

		$url = 'http://192.168.1.31/gebi/merchant/app/user/getRegisterVerifyCode';
		$param = array('mobile' => '18580896679');
		$this->_request($url, $param);
	}
    /**
     * 忘记验证吗
     */
    public function getForgetPasswordVerifyCode(){

        $url = 'http://192.168.1.31/gebi/merchant/app/user/getForgetPasswordVerifyCode';
        $param = array('mobile' => '18580896679');
        $this->_request($url, $param);
    }
    /**
     * 注册
     */
    public function register(){

        $url = 'http://192.168.1.31/gebi/merchant/app/user/register';
        $param = array(
            'mobile' => '18580896678',
            'code' => '123456',
            'password' => '123456',
            're_password' => '123456',
        );

        $this->_request($url, $param);
    }

    /**
     *验证发送手机发送的验证码是否合法
     */
    public function verifyMobileCode(){
        $url = 'http://192.168.1.31/gebi/merchant/app/user/verifyMobileCode';
        $param = array('mobile' => '18883281437','code'=>'80280','type'=>'1');
        $this->_request($url, $param);
    }

	/**
	 * 登录
	 */
	public function login(){
		
		$url = $this->HTTP.'user/login';
		$param = array(
            'mobile' => '18580896679',
            'password' => '123456',
        );
		
		$this->_request($url, $param);
	}

	/**
	 * 忘记密码
	 */
	public function forgetPassword(){
		
		$url = 'http://192.168.1.31/gebi/merchant/app/user/forgetPassword';
		$param = array(
					'mobile' => '18580896679',
					'code' => '64423',
					'password' => 'ft01721',
					're_password' => 'ft01721',
				);
		$this->_request($url, $param);		
	}
	
	/**
	 * 密码修改
	 */
	public function password(){
	
		$url = 'http://192.168.1.31/gebi/merchant/app/user/password';
		$param = array(
				'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
				'old_password' => '123456',
				'password' => '654321',
				're_password' => '654321',
		);
		$this->_request($url, $param);
	}

    /**
     * 获取登录用户信息
     */
    public function getUserInfo(){

        $url = 'http://192.168.1.31/gebi/merchant/app/user/getUserInfo';
        $param = array(
            'sessionid' => encode('565ab49b44cfb8990cf3c6b50f032505088d0c4ab'),
        );

        $this->_request($url, $param);
    }

    /**
     * 店铺类型
     */
    public function shopCategory(){
        $url = 'http://192.168.1.31/gebi/merchant/app/certification/shopCategory';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
        );
        $this->_request($url, $param);
    }

    /**
     * 店铺认证
     */
    public function shopCertification(){
        $url = 'http://192.168.1.31/gebi/merchant/app/certification/shopCertification';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
        );
        $this->_request($url, $param);
    }

    /**
     * 获取店铺认证信息
     */
    public function certifyInfo(){
        $url = 'http://192.168.1.31/gebi/merchant/app/certification/certifyInfo';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),

        );
        $this->_request($url, $param);
    }

    /**
     * 商家认证广告图
     */
    public function ads(){
        $url = 'http://192.168.1.31/gebi/merchant/app/certification/ads';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),

        );
        $this->_request($url, $param);
    }
    /**
     * 获取店铺优惠信息
     */
    public function getInfo(){
        $url = 'http://192.168.1.31/gebi/merchant/app/promotion/getInfo';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),

        );
        $this->_request($url, $param);
    }
    /**
     * 朋友圈发布
     */
    public function addFriendsCircle(){
        $url = $this->HTTP.'friendsCircle/addFriendsCircle';
        $param = array(
            'page' => '1',
            'sessionid' => $this->SESSIONID,
            'content' => '123123123123sa1d231sa32d132as1d231as23d123as1d23a1sd231as23d123as1d32',
        );

        $this->_request($url, $param);
    }
    /**
     * 朋友圈列表
     */
    public function myFriendsCircle(){
        $url = $this->HTTP.'friendsCircle/myFriendsCircle';
        $param = array(
            'page' => '1',
            'sessionid' => $this->SESSIONID,
        );

        $this->_request($url, $param);
    }
    /**
     * 朋友圈列表
     */
    public function friendsCircleDetail(){
        $url = $this->HTTP.'friendsCircle/friendsCircleDetail';
        $param = array(
            'fid' => '4',
            'sessionid' => $this->SESSIONID,
        );

        $this->_request($url, $param);
    }
    /**
     * 朋友圈列表
     */
    public function deleteFriendsCircle(){
        $url = $this->HTTP.'friendsCircle/deleteFriendsCircle';
        $param = array(
            'fid' => '3',
            'sessionid' => $this->SESSIONID,
        );

        $this->_request($url, $param);
    }
    /**
     * 发放红包
     */
    public function sendBonus(){

        $url = 'http://192.168.1.35/gebi/merchant/app/promotion/sendBonus';
        $param = array(
            'sessionid' => encode('4b759d5f021d7f868767a922b8754aa759f293b6'),
            'amount' => 100,
            'number' => 10,
            'pay_type' => 1,
            'start_time' => '2017-12-29',
            'end_time' => '2018-01-05',
            'pay_password' => '123456'
        );

        $this->_request($url, $param);
    }

    /**
     * 支付宝回调
     */
    public function zfbCallback(){
        $url = 'http://192.168.1.31/gebi/merchant/app/pay/zfbCallback';
        $param = array(
            //'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'trade_status' => 'TRADE_SUCCESS',
            'out_trade_no' => '201711161015259087',
            'total_amount' => 100,


        );

        $this->_request($url, $param);
    }
    /**
     *提前结束红包活动（仅进行中的活动可提前结束）
     */
    public function endBonus(){
        $url = 'http://192.168.1.31/gebi/merchant/app/promotion/endBonus';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'bonus_id'=>4
        );

        $this->_request($url, $param);
    }
    /**
     * 编辑红包(仅未开始活动可以编辑)
     */
    public function editBonusInfo(){
        $url = 'http://192.168.1.31/gebi/merchant/app/promotion/editBonusInfo';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'bonus_id' => 6,
            'number' => 10,
            'start_time' => '2017-11-20',
            'end_time' => '2017-11-26',

        );
        $this->_request($url, $param);
    }
    /**
     * 红包详情
     */
    public function bonusInfo(){
        $arr = array(
            array('step')
        );

        $url = 'http://192.168.1.31/gebi/merchant/app/promotion/bonusInfo';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'bonus_id' =>4,
            'page'=>1
        );
        $this->_request($url, $param);
    }

    /**
     * 商盟红包
     */
    public function bonusList(){

        $data = array(
           array('type'=>1,'content'=>'测试'),
           array('type'=>1,'content'=>'http://139.199.211.51/gebi/uploads/temp/17121509530613412.png?r=96097'),
        );

        $url = 'http://192.168.1.31/gebi/merchant/app/promotion/bonusList';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'page' => 1
        );

        $this->_request($url, $param);
    }

    /**
     * 设置代金券
     */
    public function addCashCoupon(){
        $url = 'http://192.168.1.31/gebi/merchant/app/promotion/addCashCoupon';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'money' => 20,
            'valid_hour' => 20,
            'receive' => 500,
            'condition' => 1000,
            'able_cash_coupon' => 2,

        );
        $this->_request($url, $param);
    }

    /**
     * 代金券
     */
    public function cashCoupon(){
        $url = 'http://192.168.1.31/gebi/merchant/app/promotion/cashCoupon';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),

        );
        $this->_request($url, $param);
    }

    /**
     * 设置满减规则
     */
    public function addFullCut(){
        $url = 'http://192.168.1.31/gebi/merchant/app/promotion/addFullCut';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'start_time' =>'2017-11-16',
            'end_time' =>'2017-11-16',
            'rule' =>'[{"money":"0","max_money":"0"},{"money":"0","max_money":"0"},{"money":"0","max_money":"0"}]',

        );
        $this->_request($url, $param);
    }

    /**
     * 满减
     */
    public function fullCut(){
        $url = 'http://192.168.1.35/gebi/merchant/app/promotion/fullCut';
        $param = array(
            'sessionid' => $this->SESSIONID,
        );
        $this->_request($url, $param);
    }

    /**
     * 店铺优惠设置
     */
    public function editPromotion(){
        $url = 'http://192.168.1.31/gebi/merchant/app/promotion/editPromotion';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'keyword' =>'min_consume',
            'value' =>'15.2',
        );
        $this->_request($url, $param);
    }

    /**
     * 店铺图片
     */
    public function addStoreImg(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/addStoreImg';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'images' => '["http:\/\/192.168.1.31\/gebi\/uploads\/temp\/17112703062190794.png?r=45651"]'
        );
        $this->_request($url, $param);
    }

    /**
     * 店铺优惠设置
     */
    public function storeInfo(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/storeInfo';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab')


        );

        $this->_request($url, $param);
    }

    /**
     * 设置店铺营业时间
     */
    public function setBusinessTime(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/setBusinessTime';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'time' => json_encode(array(
                array('start' => '1:00','end' => '2:00'),
                array('start' => '00:01','end' => '2:00'),
                array('start' => '00:01','end' => '23:59'),

            ))
        );
p($param);
        $this->_request($url, $param);
    }

    /**
     * 设置店铺周营业日
     */
    public function setBusinessWeek(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/setBusinessWeek';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'business_week' => '[7,4,3,1,2]',
        );
        $this->_request($url, $param);
    }


    /**
     * 设置店铺提现密码
     */
    public function setWithdrawPassword(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/setWithdrawPassword';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'code' => '123456',
            'password' => '123456',
            're_password' => '123456',
        );
        $this->_request($url, $param);
    }

    /**
     * 修改店铺提现密码
     */
    public function withdrawPassword(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/withdrawPassword';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'old_password' => '123456',
            'password' => '123456',
            're_password' => '123456',
        );
        $this->_request($url, $param);
    }

    /**
     * 提交反馈意见
     */
    public function feedback(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/feedback';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'content' => '123456',

        );
        $this->_request($url, $param);
    }

    /**
     * 历史反馈意见
     */
    public function feedbackList(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/feedbackList';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'page' => '1',

        );
        $this->_request($url, $param);
    }

    /**
     * 银行列表
     */
    public function bankList(){

        $url = 'http://192.168.1.31/gebi/merchant/app/account/bankList';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'page' => '1',

        );
        $this->_request($url, $param);
    }

    /**
     * 添加银行卡
     */
    public function addBankCard(){

        $url = 'http://192.168.1.35/gebi/merchant/app/account/addBankCard';
        $param = array(
            'sessionid' => encode('44b7e2bcd6ee3828c5e391d95580517aaa27fa5b'),
            'bank_id' => '10',
            'account_name' => '龙波',
            'account_number' => '6214831238928805',
            'mobile' => '18623474096',

        );
        $this->_request($url, $param);
    }

    /**
     * 添加支付宝
     */
    public function addAlipay(){

        $url = 'http://192.168.1.31/gebi/merchant/app/account/addAlipay';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'account_name' => '郝美丽',
            'account_number' => '1490917965',

        );
        $this->_request($url, $param);
    }

    /**
     * 银行卡、支付宝列表
     * type 1：银行卡 2：支付宝
     */
    public function accountList(){
        $url = 'http://192.168.1.31/gebi/merchant/app/account/accountList';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'type' => '2',
            'page' => '1',

        );
        $this->_request($url, $param);
    }

    /**
     * 添加提现申请
     */
    public function withdrawal(){

        $url = 'http://192.168.1.31/gebi/merchant/app/account/withdrawal';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'amount' => '10',
            'id' => '12',
            'password' => '123456',

        );
        $this->_request($url, $param);
    }

    /**
     * 资金明细
     *
     */
    public function fundDetails(){
        $url = 'http://192.168.1.31/gebi/merchant/app/account/fundDetails';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'page' => '1',
            'year' => '2017',
            'month' => '11',
        );
        $this->_request($url, $param);
    }

    /**
     * 平台分类
     *
     */
    public function category(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/category';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),

        );
        $this->_request($url, $param);
    }

    /**
     * 平台分类
     *
     */
    public function childCategory(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/childCategory';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'id' => 1
        );
        $this->_request($url, $param);
    }

    /**
     * 添加自定义分类
     *
     */
    public function addCategory(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/addCategory';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'id' => 14,
            'parent_id' => 1,
            'cat_name' => '养身自助',
            'category_id' => 5
        );
        $this->_request($url, $param);
    }

    /**
     * 自定义分类详情
     */
    public function customCategoryInfo(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/customCategoryInfo';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'id' => 13,
        );
        $this->_request($url, $param);
    }

    /**
     * 删除自定义分类
     */
    public function delCustomCategory(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/delCustomCategory';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'id' => 14,
        );
        $this->_request($url, $param);
    }
    /**
     * 获取所有自定义分类
     *
     */
    public function getAllCategory(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/getAllCategory';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'page' => 1,
        );
        $this->_request($url, $param);
    }

    /**
     * 获取自定义分类列表
     *
     */
    public function getCategoryList(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/getCategoryList';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'page' => 1,
        );
        $this->_request($url, $param);
    }
    /**
     * 添加商品
     *
     */
    public function addProduct(){
        $a = array(
            array(
                'name' => '辣度',
                'value' => array('微辣','变态辣'),
            ),
            array(
                'name' => '大小',
                'value' => array('500','1000'),
            ),
        );
        $b = array(
            array(
                'property' => '大锅',
                'price' => '100',
                'is_limited' => '2',
                'quantity' => '0',
            ),
            array(
                'property' => '小锅',
                'price' => '50',
                'is_limited' => '2',
                'quantity' => '0',
            )
        );
        $url = 'http://192.168.1.31/gebi/merchant/app/product/addProduct';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'category_id' => 47,
        );

        $this->_request($url, $param);
    }

    /**
     * 获取商品列表
     *
     */
    public function productList(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/productList';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'page' => 1,
            'order' => 1,
            'custom_id' => 47,
        );
        $this->_request($url, $param);
    }

    /**
     * 标签变体
     */
    public function variant(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/variant';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'is_limited' => 1,
            'price' => 100,
            'quantity' => 0,
            'lable' => '[{"lable":"颜色","value":"蓝色, 绿色"}]',
        );
        $this->_request($url, $param);
        p(encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'));
    }
    /**
     * 商品详情
     */
    public function productInfo(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/productInfo';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'id' => 143,
        );
        $this->_request($url, $param);
    }

    /**
     * 商品详情信息
     */
    public function productDetail(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/productDetail';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'id' => 143,
        );
        $this->_request($url, $param);
    }
    /**
     * 商品详情信息
     */
    public function onSale(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/onSale';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'id' => 10,
            'status' => 2,
        );
        $this->_request($url, $param);
    }

    /**
     * 获取可申请的广告位列表
     *
     */
    public function adsPosition(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/adsPosition';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),

        );
        $this->_request($url, $param);
    }

    /**
     * 广告申请记录
     */
    public function getApplyAdsList(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/getApplyAdsList';
        $param = array(
            'sessionid' => encode('f4af56f55cd2473b92aa850323525fc379f2590e'),
            'page' => 1,

        );
        $this->_request($url, $param);
    }
    /**
     * 取消广告申请
     */
    public function cancelApplyAds(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/cancelApplyAds';
        $param = array(
            'sessionid' => encode('6a699c3a0f1e706054fff5957dc6b4a3ff0b1eb3'),
            'id' => 12,

        );
        $this->_request($url, $param);
    }
    /**
     * 消息管理
     */
    public function getMessageList(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/getMessageList';
        $param = array(
            'sessionid' => encode('41221534e5746a7c55cc3ed60b5889fea9805e10'),
            'page' => 1,
            'type' => 3,
        );

        $this->_request($url, $param);
    }

    /**
     * 系统消息详情
     */
    public function messageDetail(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/messageDetail';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'id' => 1,
        );

        $this->_request($url, $param);
    }

    /**
     * 删除消息
     */
    public function delMessage(){
        $url = $this->HTTP.'store/delMessage';
        $param = array(
            'sessionid' => $this->SESSIONID,
            'id' => 3,
        );

        $this->_request($url, $param);
    }

    /**
     * 店铺评价
     */
    public function comment(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/comment';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),

        );
        $this->_request($url, $param);
    }

    /**
     * 店铺全部评论
     */
    public function getCommentList(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/getCommentList';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'page' => 1,
            'type'=>1

        );
        $this->_request($url, $param);
    }

    /**
     * 店铺财务统计
     */
    public function statistics(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/statistics';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'page' => 1

        );
        $this->_request($url, $param);
    }

    /**
     * 店铺财务统计
     */
    public function statisticsDetail(){
        $url = 'http://192.168.1.31/gebi/merchant/app/store/statisticsDetail';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'year' => 2017,
            'month' => 11,
            'page' => 1

        );
        $this->_request($url, $param);
    }

    /**
     * 售后订单列表
     */
    public function afterSaleList(){
        $url = 'http://192.168.1.31/gebi/merchant/app/order/afterSaleList';
        $param = array(
            'sessionid' => encode('ef892922c37eadb3f199caca5fc71832032e45f2'),
            'status' => 0,
            'page' => 1

        );
        $this->_request($url, $param);
    }

    /**
     * 售后订单列表
     */
    public function afterSaleDetail(){
        $url = 'http://192.168.1.35/gebi/merchant/app/order/afterSaleDetail';
        $param = array(
            'sessionid' => $this->SESSIONID,
            'id' => '2',
        );
        $this->_request($url, $param);
    }

    /**
     * 售后同意退款
     */
    public function agreeRefund(){
        $url = 'http://192.168.1.35/gebi/merchant/app/order/agreeRefund';
        $param = array(
            'sessionid' => encode('41221534e5746a7c55cc3ed60b5889fea9805e10'),
            'code' => '20171227111521825367',
        );
        $this->_request($url, $param);
    }

    /**
     *商品订单
     */
    public function orderList(){
        $url = $this->HTTP.'order/orderList';
        $param = array(
            'sessionid' => encode('5fdd86186b5b43159ffdf346644d564e6d197e3a'),
           'page' => 1,
           'status' => 3,
           'expense_type' => 1,
        );

        $this->_request($url, $param);
    }

    /**
     *订单详情
     */
    public function orderDetail(){
        $url = $this->HTTP.'order/orderDetail';
        $param = array(
            'sessionid' => encode('c04c67a3ac0acfdebf29fe0fb96d48928ed2e509'),
            'id' => 231,
        );

        $this->_request($url, $param);
    }

    /**
     * 物流公司
     */
    public function shippingCompany(){
        $url = 'http://192.168.1.31/gebi/merchant/app/order/shippingCompany';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),

        );

        $this->_request($url, $param);
    }
    /**
     * 获取物流跟踪信息
     */
    public function getOrderExpress(){

        $url = 'http://139.199.211.51/gebi/merchant/app/order/getOrderExpress';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'order_id' => 181
        );
        $this->_request($url, $param);
    }
    /**
     * 支付方式
     */
    public function payType(){
        $url = 'http://192.168.1.31/gebi/merchant/app/promotion/payType';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),

        );

        $this->_request($url, $param);
    }
    /**
     * 核销订单
     */
    public function checkOrder(){
        $url = 'http://192.168.1.35/gebi/merchant/app/order/checkOrder';
        $param = array(
            'sessionid' => $this->SESSIONID,
            'id' =>68
        );
        $this->_request($url, $param);
    }

    /**
     * 核销记录
     */
    public function checkOrderList(){
        $url = $this->HTTP.'order/checkOrderList';
        $param = array(
            'sessionid' => encode('3fe2e7c46aad1b03d8cafa1a591670748c11825a'),
            'page' =>1
        );
        $this->_request($url, $param);
    }
    /**
     * 关于我们
     *
     */
    public function aboutUs(){
        $url = 'http://192.168.1.31/gebi/merchant/app/common/aboutUs';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
        );
        $this->_request($url, $param);
    }
    /**
     * 提现说明
     *
     */
    public function withdraw(){
        $url = 'http://192.168.1.31/gebi/merchant/app/common/withdraw';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
        );
        $this->_request($url, $param);
    }


    /**
     * 注册协议
     *
     */
    public function agreement(){
        $url = 'http://192.168.1.31/gebi/merchant/app/common/agreement';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
        );
        $this->_request($url, $param);
    }

    /**
     * 配送费计算
     *
     */
    public function cart_freight(){
        $url = 'http://192.168.1.31/gebi/merchant/app/common/cart_freight';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
        );
        $this->_request($url, $param);
    }


    /**
     * 商家升级说明
     *
     */
    public function upgrade(){
        $url = 'http://192.168.1.31/gebi/merchant/app/common/upgrade';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
        );
        $this->_request($url, $param);
    }

    /**
     * 接单
     */
    public function takeOrder(){
        $url = $this->HTTP.'order/takeOrder';
        $param = array(
            'id' => 290,
            'sessionid' => encode('202f60546a7947ce70838250d8481a5fb41dfb5b'),
        );
        $this->_request($url, $param);
    }

    /**
     * 自定义分类排序
     */
    public function categorySort(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/categorySort';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'text' => '[{"id":"47","sort":"1"},{"id":"54","sort":"10"}]',
        );
        $this->_request($url, $param);
    }

    /**
     * 商品排序
     */
    public function productSort(){
        $url = 'http://192.168.1.31/gebi/merchant/app/product/productSort';
        $param = array(
            'sessionid' => encode('565ab49b44cfb899cf3c6b50f032505088d0c4ab'),
            'text' => '[{"id":"127","sort":"1"},{"id":"128","sort":"10"}]',
        );
        $this->_request($url, $param);
    }

    public function orderTracking()
    {
        $url = 'http://192.168.1.35/gebi/merchant/app/order/orderTracking';
        $param = array(
            'sessionid' => encode('a6e75e5468f104a366f4488ef96173b19487e19b'),
            'order_id' => 244,
        );
        $this->_request($url, $param);
    }

    /**
	 * 请求接口
	 * 
	 * @param	string	$url	请求路径
	 * @param 	array 	$param	请求参数
	 */
	private function _request($url, $param){
		
		$curl = curl_init();
	    curl_setopt($curl, CURLOPT_URL, $url);
	    curl_setopt($curl, CURLOPT_HEADER, 0);
	    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
	    curl_setopt($curl, CURLOPT_POST, true);
	    curl_setopt($curl, CURLOPT_POSTFIELDS, $param);
	    curl_setopt($curl, CURLOPT_TIMEOUT, 30);
	    $data = curl_exec($curl);
	    if(curl_errno($curl)){
	    	p(curl_error($curl));
	    	exit(array('status' => 0, 'data' => NULL, 'message' => curl_error($curl)));
		}
	    curl_close($curl);
	    echo $data;
	}
}
